package com.cars.grpc.auth;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 *
 */
@javax.annotation.Generated(
        value = "by gRPC proto compiler (version 1.12.0)",
        comments = "Source: auth.proto")
public final class AuthServiceGrpc {

    private AuthServiceGrpc() {
    }

    public static final String SERVICE_NAME = "auth.AuthService";

    // Static method descriptors that strictly reflect the proto.
    @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
    @java.lang.Deprecated // Use {@link #getIsLoginMethod()} instead.
    public static final io.grpc.MethodDescriptor<com.google.protobuf.Empty,
            com.cars.grpc.auth.Auth.GrpcBool> METHOD_IS_LOGIN = getIsLoginMethodHelper();

    private static volatile io.grpc.MethodDescriptor<com.google.protobuf.Empty,
            com.cars.grpc.auth.Auth.GrpcBool> getIsLoginMethod;

    @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
    public static io.grpc.MethodDescriptor<com.google.protobuf.Empty,
            com.cars.grpc.auth.Auth.GrpcBool> getIsLoginMethod() {
        return getIsLoginMethodHelper();
    }

    private static io.grpc.MethodDescriptor<com.google.protobuf.Empty,
            com.cars.grpc.auth.Auth.GrpcBool> getIsLoginMethodHelper() {
        io.grpc.MethodDescriptor<com.google.protobuf.Empty, com.cars.grpc.auth.Auth.GrpcBool> getIsLoginMethod;
        if ((getIsLoginMethod = AuthServiceGrpc.getIsLoginMethod) == null) {
            synchronized (AuthServiceGrpc.class) {
                if ((getIsLoginMethod = AuthServiceGrpc.getIsLoginMethod) == null) {
                    AuthServiceGrpc.getIsLoginMethod = getIsLoginMethod =
                            io.grpc.MethodDescriptor.<com.google.protobuf.Empty, com.cars.grpc.auth.Auth.GrpcBool>newBuilder()
                                    .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
                                    .setFullMethodName(generateFullMethodName(
                                            "auth.AuthService", "isLogin"))
                                    .setSampledToLocalTracing(true)
                                    .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                                            com.google.protobuf.Empty.getDefaultInstance()))
                                    .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                                            com.cars.grpc.auth.Auth.GrpcBool.getDefaultInstance()))
                                    .setSchemaDescriptor(new AuthServiceMethodDescriptorSupplier("isLogin"))
                                    .build();
                }
            }
        }
        return getIsLoginMethod;
    }

    @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
    @java.lang.Deprecated // Use {@link #getLoginMethod()} instead.
    public static final io.grpc.MethodDescriptor<com.cars.grpc.auth.Auth.GrpcInt,
            com.cars.grpc.auth.Auth.GrpcString> METHOD_LOGIN = getLoginMethodHelper();

    private static volatile io.grpc.MethodDescriptor<com.cars.grpc.auth.Auth.GrpcInt,
            com.cars.grpc.auth.Auth.GrpcString> getLoginMethod;

    @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
    public static io.grpc.MethodDescriptor<com.cars.grpc.auth.Auth.GrpcInt,
            com.cars.grpc.auth.Auth.GrpcString> getLoginMethod() {
        return getLoginMethodHelper();
    }

    private static io.grpc.MethodDescriptor<com.cars.grpc.auth.Auth.GrpcInt,
            com.cars.grpc.auth.Auth.GrpcString> getLoginMethodHelper() {
        io.grpc.MethodDescriptor<com.cars.grpc.auth.Auth.GrpcInt, com.cars.grpc.auth.Auth.GrpcString> getLoginMethod;
        if ((getLoginMethod = AuthServiceGrpc.getLoginMethod) == null) {
            synchronized (AuthServiceGrpc.class) {
                if ((getLoginMethod = AuthServiceGrpc.getLoginMethod) == null) {
                    AuthServiceGrpc.getLoginMethod = getLoginMethod =
                            io.grpc.MethodDescriptor.<com.cars.grpc.auth.Auth.GrpcInt, com.cars.grpc.auth.Auth.GrpcString>newBuilder()
                                    .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
                                    .setFullMethodName(generateFullMethodName(
                                            "auth.AuthService", "login"))
                                    .setSampledToLocalTracing(true)
                                    .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                                            com.cars.grpc.auth.Auth.GrpcInt.getDefaultInstance()))
                                    .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                                            com.cars.grpc.auth.Auth.GrpcString.getDefaultInstance()))
                                    .setSchemaDescriptor(new AuthServiceMethodDescriptorSupplier("login"))
                                    .build();
                }
            }
        }
        return getLoginMethod;
    }

    /**
     * Creates a new async stub that supports all call types for the service
     */
    public static AuthServiceStub newStub(io.grpc.Channel channel) {
        return new AuthServiceStub(channel);
    }

    /**
     * Creates a new blocking-style stub that supports unary and streaming output calls on the service
     */
    public static AuthServiceBlockingStub newBlockingStub(
            io.grpc.Channel channel) {
        return new AuthServiceBlockingStub(channel);
    }

    /**
     * Creates a new ListenableFuture-style stub that supports unary calls on the service
     */
    public static AuthServiceFutureStub newFutureStub(
            io.grpc.Channel channel) {
        return new AuthServiceFutureStub(channel);
    }

    /**
     *
     */
    public static abstract class AuthServiceImplBase implements io.grpc.BindableService {

        /**
         *
         */
        public void isLogin(com.google.protobuf.Empty request,
                            io.grpc.stub.StreamObserver<com.cars.grpc.auth.Auth.GrpcBool> responseObserver) {
            asyncUnimplementedUnaryCall(getIsLoginMethodHelper(), responseObserver);
        }

        /**
         *
         */
        public void login(com.cars.grpc.auth.Auth.GrpcInt request,
                          io.grpc.stub.StreamObserver<com.cars.grpc.auth.Auth.GrpcString> responseObserver) {
            asyncUnimplementedUnaryCall(getLoginMethodHelper(), responseObserver);
        }

        @java.lang.Override
        public final io.grpc.ServerServiceDefinition bindService() {
            return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
                    .addMethod(
                            getIsLoginMethodHelper(),
                            asyncUnaryCall(
                                    new MethodHandlers<
                                            com.google.protobuf.Empty,
                                            com.cars.grpc.auth.Auth.GrpcBool>(
                                            this, METHODID_IS_LOGIN)))
                    .addMethod(
                            getLoginMethodHelper(),
                            asyncUnaryCall(
                                    new MethodHandlers<
                                            com.cars.grpc.auth.Auth.GrpcInt,
                                            com.cars.grpc.auth.Auth.GrpcString>(
                                            this, METHODID_LOGIN)))
                    .build();
        }
    }

    /**
     *
     */
    public static final class AuthServiceStub extends io.grpc.stub.AbstractStub<AuthServiceStub> {
        private AuthServiceStub(io.grpc.Channel channel) {
            super(channel);
        }

        private AuthServiceStub(io.grpc.Channel channel,
                                io.grpc.CallOptions callOptions) {
            super(channel, callOptions);
        }

        @java.lang.Override
        protected AuthServiceStub build(io.grpc.Channel channel,
                                        io.grpc.CallOptions callOptions) {
            return new AuthServiceStub(channel, callOptions);
        }

        /**
         *
         */
        public void isLogin(com.google.protobuf.Empty request,
                            io.grpc.stub.StreamObserver<com.cars.grpc.auth.Auth.GrpcBool> responseObserver) {
            asyncUnaryCall(
                    getChannel().newCall(getIsLoginMethodHelper(), getCallOptions()), request, responseObserver);
        }

        /**
         *
         */
        public void login(com.cars.grpc.auth.Auth.GrpcInt request,
                          io.grpc.stub.StreamObserver<com.cars.grpc.auth.Auth.GrpcString> responseObserver) {
            asyncUnaryCall(
                    getChannel().newCall(getLoginMethodHelper(), getCallOptions()), request, responseObserver);
        }
    }

    /**
     *
     */
    public static final class AuthServiceBlockingStub extends io.grpc.stub.AbstractStub<AuthServiceBlockingStub> {
        private AuthServiceBlockingStub(io.grpc.Channel channel) {
            super(channel);
        }

        private AuthServiceBlockingStub(io.grpc.Channel channel,
                                        io.grpc.CallOptions callOptions) {
            super(channel, callOptions);
        }

        @java.lang.Override
        protected AuthServiceBlockingStub build(io.grpc.Channel channel,
                                                io.grpc.CallOptions callOptions) {
            return new AuthServiceBlockingStub(channel, callOptions);
        }

        /**
         *
         */
        public com.cars.grpc.auth.Auth.GrpcBool isLogin(com.google.protobuf.Empty request) {
            return blockingUnaryCall(
                    getChannel(), getIsLoginMethodHelper(), getCallOptions(), request);
        }

        /**
         *
         */
        public com.cars.grpc.auth.Auth.GrpcString login(com.cars.grpc.auth.Auth.GrpcInt request) {
            return blockingUnaryCall(
                    getChannel(), getLoginMethodHelper(), getCallOptions(), request);
        }
    }

    /**
     *
     */
    public static final class AuthServiceFutureStub extends io.grpc.stub.AbstractStub<AuthServiceFutureStub> {
        private AuthServiceFutureStub(io.grpc.Channel channel) {
            super(channel);
        }

        private AuthServiceFutureStub(io.grpc.Channel channel,
                                      io.grpc.CallOptions callOptions) {
            super(channel, callOptions);
        }

        @java.lang.Override
        protected AuthServiceFutureStub build(io.grpc.Channel channel,
                                              io.grpc.CallOptions callOptions) {
            return new AuthServiceFutureStub(channel, callOptions);
        }

        /**
         *
         */
        public com.google.common.util.concurrent.ListenableFuture<com.cars.grpc.auth.Auth.GrpcBool> isLogin(
                com.google.protobuf.Empty request) {
            return futureUnaryCall(
                    getChannel().newCall(getIsLoginMethodHelper(), getCallOptions()), request);
        }

        /**
         *
         */
        public com.google.common.util.concurrent.ListenableFuture<com.cars.grpc.auth.Auth.GrpcString> login(
                com.cars.grpc.auth.Auth.GrpcInt request) {
            return futureUnaryCall(
                    getChannel().newCall(getLoginMethodHelper(), getCallOptions()), request);
        }
    }

    private static final int METHODID_IS_LOGIN = 0;
    private static final int METHODID_LOGIN = 1;

    private static final class MethodHandlers<Req, Resp> implements
            io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
            io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
            io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
            io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
        private final AuthServiceImplBase serviceImpl;
        private final int methodId;

        MethodHandlers(AuthServiceImplBase serviceImpl, int methodId) {
            this.serviceImpl = serviceImpl;
            this.methodId = methodId;
        }

        @java.lang.Override
        @java.lang.SuppressWarnings("unchecked")
        public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
            switch (methodId) {
                case METHODID_IS_LOGIN:
                    serviceImpl.isLogin((com.google.protobuf.Empty) request,
                            (io.grpc.stub.StreamObserver<com.cars.grpc.auth.Auth.GrpcBool>) responseObserver);
                    break;
                case METHODID_LOGIN:
                    serviceImpl.login((com.cars.grpc.auth.Auth.GrpcInt) request,
                            (io.grpc.stub.StreamObserver<com.cars.grpc.auth.Auth.GrpcString>) responseObserver);
                    break;
                default:
                    throw new AssertionError();
            }
        }

        @java.lang.Override
        @java.lang.SuppressWarnings("unchecked")
        public io.grpc.stub.StreamObserver<Req> invoke(
                io.grpc.stub.StreamObserver<Resp> responseObserver) {
            switch (methodId) {
                default:
                    throw new AssertionError();
            }
        }
    }

    private static abstract class AuthServiceBaseDescriptorSupplier
            implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
        AuthServiceBaseDescriptorSupplier() {
        }

        @java.lang.Override
        public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
            return com.cars.grpc.auth.Auth.getDescriptor();
        }

        @java.lang.Override
        public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
            return getFileDescriptor().findServiceByName("AuthService");
        }
    }

    private static final class AuthServiceFileDescriptorSupplier
            extends AuthServiceBaseDescriptorSupplier {
        AuthServiceFileDescriptorSupplier() {
        }
    }

    private static final class AuthServiceMethodDescriptorSupplier
            extends AuthServiceBaseDescriptorSupplier
            implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
        private final String methodName;

        AuthServiceMethodDescriptorSupplier(String methodName) {
            this.methodName = methodName;
        }

        @java.lang.Override
        public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
            return getServiceDescriptor().findMethodByName(methodName);
        }
    }

    private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

    public static io.grpc.ServiceDescriptor getServiceDescriptor() {
        io.grpc.ServiceDescriptor result = serviceDescriptor;
        if (result == null) {
            synchronized (AuthServiceGrpc.class) {
                result = serviceDescriptor;
                if (result == null) {
                    serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
                            .setSchemaDescriptor(new AuthServiceFileDescriptorSupplier())
                            .addMethod(getIsLoginMethodHelper())
                            .addMethod(getLoginMethodHelper())
                            .build();
                }
            }
        }
        return result;
    }
}
